<link rel="stylesheet" type="text/css" href="<?php echo $this->_baseUrl;?>/public/css/admin.css"/>
<div id="toolbar" >
  <div class="right-toolbar">
  <a title="Lưu">
  <button onclick="document.forms['createVm'].submit()">
  <img src="<?php echo $this->_baseUrl;?>/public/images/web/save.png" height="32px" width="32px"/>
  <span><p>Lưu</p></span>
  </button>
  </a>
  </div>
  <div class="left-toolbar">
  <img src="<?php echo $this->_baseUrl;?>/public/images/web/vmware.png" height="48px" width="48px"/>
  <span>Thêm máy ảo</span>
  </div>
</div>

<div id="box-content">
 <div id="box-content1">
    <form id="createVm" action="<?php echo $this->_baseUrl;?>/vm/create" method="post">
      <?php
        if($this->status == 1)
        {
      ?>      
      <div style="padding-bottom:15px; color:#FF0000;width:400px;font-weight:bold;">
      <img src="<?php echo $this->_baseUrl;?>/public/images/web/error.png" width="32" height="32" style="float:left; margin-right:10px;"/>
      Lỗi : <?php echo $this->message;?>
      </div>
      <?php
       }
      ?>
      <p>
        <label>Tên máy ảo</label>
        <input type="text" name="vmname" style="padding: 5px;width: 500px;" value="<?php echo $this->input_vmname;?>"/>
      </p>
      <p>
        <label>Thời gian (phút)</label>
        <input type="text" name="time" style="padding: 5px;width: 500px;" value="<?php echo $this->input_time;?>"/>
      </p>
      
      <p>
        <label>Gói</label>
        <select name="package" class="styled">
            <?php
            if($this->listPackage != null)
    		 {
      			 $countPackage = count($this->listPackage); 
       			 for( $k = 0; $k < $countPackage ; $k++)
      			 {
            ?>
            <option value="<?php echo $this->listPackage[$k]['package_id'];?>" 
                  <?php if($this->input_package == $this->listPackage[$k]['package_id']) echo "selected='selected'";?>>
                  <?php echo $this->listPackage[$k]['package_name'];?></option>
            <?php 
      			 }     
    		 }     
            ?>
        </select>
      </p>
     
      <p>
         <label>&nbsp;</label>
         <textarea rows="7" cols="35" readonly="readonly">
         </textarea>
      </p>

    </form>
    
    <script type="text/javascript">
    	$(document).ready(function(){
         	 function loadPackage(id){
         			$('p textarea').load('<?php echo $this->_baseUrl;?>'+"/package/view/id/"+id);
             }
         	if($('select').val() != null)
             loadPackage($('select').val());
             $('select').change(function() {
            	  loadPackage($(this).val());
            	});
   		 });
    </script>
 </div>
</div>